let cart = [
  { name: "iphone", price: 15000 },
  { name: "imac", price: 25000 },
  { name: "ipad", price: 11000 }
];
function maxPrice(array) {
  return array.reduce(function(pre, cur) {
    return pre.price > cur.price ? pre : cur;
  });
}
console.log(maxPrice(cart));

function sum(array) {
  return array.reduce(function(total, cur) {
    return (total += cur.price);
  }, 0);
}
console.log(sum(cart));
